package miao.demo;

import miao.demo.config.SpringConfig;
import miao.demo.dao.BookDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/*
    目标:掌握利用注解管理bean
        @Scope() //默认单例
 */
public class App {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        BookDao bookDao1 = ctx.getBean("bookDao", BookDao.class);
        BookDao bookDao2 = ctx.getBean("bookDao", BookDao.class);
        System.out.println(bookDao1);
        System.out.println(bookDao2);

        ctx.close();
    }
}
